package com.dooioo.pns.business.service;

import com.dooioo.pns.base.service.BaseService;
import com.dooioo.pns.entity.model.BusinessSide;
import org.springframework.stereotype.Service;

/**
 * Created with IntelliJ IDEA.
 * PackageName:com.dooioo.pns.business.service
 * Author: Jerry.hu
 * Create: Jerry.hu (2015-05-07 下午1:18)
 * Description:推送方信息
 */
@Service
public class BusinessSideService extends BaseService<BusinessSide> {

	/**
	 * 验证是否存在推送方的信息
	 * @param id
	 * @return
	 */
	public boolean isExists(int id){
		return super.count(sqlId("isExists"),id) > 0;
	}

	public boolean isExistsName(String name) {
		return super.count(sqlId("isExistsName"),name) > 0;
	}

	public boolean insertAndReturnId(BusinessSide businessSide){
		return super.insertAndReturnId(sqlId("insertAndReturnId"), businessSide)>0;
	}

	/**
	 *  根据业务注册id获取业务方信息
	 * @param businessId 业务注册id
	 * @return 业务方实体信息
	 */
	public BusinessSide getBean(int businessId) {
		return super.selectOne(sqlId("getBeanById"),businessId);
	}
}
